﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Account_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    
    private bool login(string username, string password, string company)
    {
        WebServiceAgent serviceAgent = UserManager.GetInstance().LogIn(username, password, company);
        if (serviceAgent == null)
        {
            LoginUser.FailureText = Constants.LOGIN_FAILED;
            return false;
        }
        else
        {
            Session.Add(Constants.USER_WEB_SERVICE_CONN, serviceAgent);
            return true;
        }
    }
    protected void LoginButton_Click(object sender, AuthenticateEventArgs e)
    {
        e.Authenticated = login(LoginUser.UserName, LoginUser.Password, "Jumex");
    }
}
